<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' encoding='UTF-8' doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent='yes'/>

	<!-- xml filesources -->
	<xsl:variable name="src_head" select="document(root/filehead/@src)"/>
	<xsl:variable name="src_head_ie" select="document(root/filehead_ie/@src)"/>
	<xsl:variable name="src_header" select="document(root/fileheader/@src)"/>
	<xsl:variable name="src_navbar" select="document(root/filenavbar/@src)"/>
	<xsl:variable name="src_footer" select="document(root/filefooter/@src)"/>
	
	<!-- template to load a static content -->
	<xsl:template name="Loader">
		<xsl:param name="src"/>  
		<xsl:copy-of select="$src/root/*[name() != 'namespace']"/>
	</xsl:template>

	<!-- template to load extra data content -->
	<xsl:template name="ExtraDataLoader">
		<xsl:param name="src"/>
		<xsl:copy-of select="$src/*[name() != 'namespace']"/>
	</xsl:template>
	
	<!-- template to load IE Fix content -->
	<xsl:template name="IELoader">
		<xsl:param name="src"/>
		<xsl:comment>[if IE 6]><xsl:value-of select="$src"/>&lt;![endif]</xsl:comment>
	</xsl:template>
	
	<!-- template to dinamically create menu -->
	<xsl:template name="NavLoader">
		<xsl:param name="src"/>
		<xsl:variable name="page" select="page"/>
		<!-- login -->
		<xsl:copy-of select="$src/root/linkable/a"/>
		<!-- navbar link list -->
		<ul id="nav_list">
			<xsl:if test="page = 'home'">
				<xsl:copy-of select="$src/root/not_linkable/ul/li[text()='Home']"/>
			</xsl:if>
			<xsl:if test="page != 'home'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='o']]"/>					
			</xsl:if>
			<xsl:if test="page = 'signup'">
				<xsl:copy-of select="$src/root/not_linkable/ul/li[text()='Sign Up']"/>
			</xsl:if>
			<xsl:if test="page != 'signup'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='s']]"/>
			</xsl:if>
			<xsl:if test="page = 'help'">
					<xsl:copy-of select="$src/root/not_linkable/ul/li[text()='Help']"/>
			</xsl:if>
			<xsl:if test="page != 'help'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='h']]"/>
			</xsl:if>
			<xsl:if test="page = 'about'">
				<xsl:copy-of select="$src/root/not_linkable/ul/li/a[text()='About']"/>
			</xsl:if>
			<xsl:if test="page != 'about'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='a']]"/>
			</xsl:if>
			<xsl:if test="page = 'sitemap'">
				<xsl:copy-of select="$src/root/not_linkable/ul/li/a[text()='Sitemap']"/>
			</xsl:if>
			<xsl:if test="page != 'sitemap'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='m']]"/>
			</xsl:if>
		</ul>
	</xsl:template>

	<!-- template to generate main content -->
	<xsl:template name="Step3Content">
		<!-- load extra tabindex params -->
		<xsl:call-template name="ExtraDataLoader">
			<xsl:with-param name="src" select="extradata/tabindex"/>
		</xsl:call-template>
		<!-- main tab page -->
		<div id="tab_wrapper">
			<!--  <p class="site_pos">You are here:  Sign Up Process - Step 3</p> -->
			<form  id="signup_form" method="post" action="../cgi-bin/browse.pl">
			  <h1>Feed subscription completed!</h1>
			  <p class="complete"><strong>OK, you subscribed your first Feed!</strong></p>
			  <p class="complete">It's time for you to visit your personal page, the one where you'll spend most of your time in :-)</p>
			  <input type="image" id="next_step_button" src="../images/last_step_signup.png" title="Browse your feeds!" alt="Browse your feeds!" />
			  <input type="hidden" name="id"><xsl:attribute name="value"><xsl:value-of select="success/id"/></xsl:attribute></input>
			</form>
		</div>
	</xsl:template>

	
	<!-- CREATE PAGE -->
	
	<!-- create page structure -->
	<xsl:template match="root">
		<html>
			<!-- head -->
			<head>
				<!-- load common code -->
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_head"/>
				</xsl:call-template>
				<!-- load extra head params -->
				<xsl:call-template name="ExtraDataLoader">
					<xsl:with-param name="src" select="extradata/head"/>
				</xsl:call-template>
				<!-- load ie fix -->
				<xsl:call-template name="IELoader">
					<xsl:with-param name="src" select="$src_head_ie/root/common"/>
				</xsl:call-template>
				<xsl:call-template name="IELoader">
					<xsl:with-param name="src" select="extradata/IEFix"/>
				</xsl:call-template>
				<!-- pagetitle -->
				<title><xsl:value-of select="pagetitle"/></title>
			</head>
			<body>
				<!-- body onload attribute -->
				<xsl:if test="extradata/body/onload/text() != ''">
					<xsl:attribute name="onLoad"><xsl:value-of select="extradata/body/onload"/></xsl:attribute>
				</xsl:if>
				<!-- header -->			
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_header"/>
				</xsl:call-template>
				<!-- navbar -->
				<div id="navbar">
					<xsl:call-template name="NavLoader">
						<xsl:with-param name="src" select="$src_navbar"/>
					</xsl:call-template>
				</div>
				<!-- content -->
				<xsl:call-template name="Step3Content">
					<xsl:with-param name="src" select="$src_footer"/>
				</xsl:call-template>				
				<!-- footer -->
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_footer"/>
				</xsl:call-template>				
			</body>
		</html>
	</xsl:template>
	
</xsl:stylesheet>
